package com.example.demo.Contorller;

import com.example.demo.entity.Movie;
import com.example.demo.service.MovieService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "movie")
@RestController
public class MovieController {
    @Autowired
    private MovieService movieService;
    @ApiOperation("添加用户信息")
    @PutMapping("/addmovie")
    public int AddMovie(Movie movie){
//        System.out.println(movie.getTime());
        return movieService.insertMovie(movie);
    }
    @ApiOperation("查询所有的数据")
    @GetMapping("/getSelectAll")
    public List<Movie> getAll(Movie movie){

        return movieService.getAll(movie);
    }
    @ApiOperation("修改信息")
    @PutMapping("/update")
    public int updateMovie(Movie movie){

        return movieService.updateMovie(movie);
    }
    @ApiOperation("删除信息")
    @PutMapping("/move")
    public int deleteMovie(int id) {

        return movieService.deleteMovie(id);
    }

}

